package com.mfin.bs.mgr.factory;

import com.mfin.bs.mgr.impl.ChitFinanceManager;
import com.mfin.bs.mgr.impl.CustomerInformationManager;
import com.mfin.bs.mgr.impl.FinanceInformationManager;
import com.mfin.bs.mgr.impl.LoanMasterManager;
import com.mfin.bs.mgr.impl.UserProfileManager;
import com.mfin.bs.mgr.interfaces.ICashBookManager;
import com.mfin.bs.mgr.interfaces.IChitFinanceManager;
import com.mfin.bs.mgr.interfaces.ICustomerInformationManager;
import com.mfin.bs.mgr.interfaces.IFinanceInformationManager;
import com.mfin.bs.mgr.interfaces.ILoanMasterManager;
import com.mfin.bs.mgr.interfaces.IUserProfileManager;
import com.mfin.log.Logger;
import com.mfin.persistence.IPersistenceGovernor;

public class BaseManagerFactory extends Logger implements IManagerFactory {

	private static BaseManagerFactory baseManagerFactory = null;

	private IChitFinanceManager chitFinanceManager = null;
	private ICustomerInformationManager customerInformationManager = null;
	private ILoanMasterManager loanMasterManager = null;
	private IUserProfileManager userProfileManager = null;
	private IFinanceInformationManager financeInformationManager = null;
	private ICashBookManager cashBookManager = null;

	private BaseManagerFactory() {
		super();
		chitFinanceManager = new ChitFinanceManager();
		customerInformationManager = new CustomerInformationManager();
		loanMasterManager = new LoanMasterManager();
		userProfileManager = new UserProfileManager();
		financeInformationManager = new FinanceInformationManager();
	}

	public static BaseManagerFactory getInstance() {
		if (baseManagerFactory == null) {
			baseManagerFactory = new BaseManagerFactory();
		}
		return baseManagerFactory;
	}

	@Override
	public IChitFinanceManager getChitFinanceManager(
			IPersistenceGovernor persistence) {
		// TODO Auto-generated method stub
		chitFinanceManager.setPersistenceGovernor(persistence);
		return chitFinanceManager;
	}

	@Override
	public ICustomerInformationManager getCustomerInformationManager(
			IPersistenceGovernor persistence) {
		// TODO Auto-generated method stub
		customerInformationManager.setPersistenceGovernor(persistence);
		return customerInformationManager;
	}

	@Override
	public ILoanMasterManager getLoanMasterManager(
			IPersistenceGovernor persistence) {
		// TODO Auto-generated method stub
		loanMasterManager.setPersistenceGovernor(persistence);
		return loanMasterManager;
	}

	@Override
	public IUserProfileManager getUserProfileManager(
			IPersistenceGovernor persistence) {
		// TODO Auto-generated method stub
		userProfileManager.setPersistenceGovernor(persistence);
		return userProfileManager;
	}

	@Override
	public IFinanceInformationManager getFinanceInformationManager(
			IPersistenceGovernor persistence) {
		// TODO Auto-generated method stub
		financeInformationManager.setPersistenceGovernor(persistence);
		return financeInformationManager;
	}

	@Override
	public ICashBookManager getCashBookManager(IPersistenceGovernor persistence) {
		// TODO Auto-generated method stub
		cashBookManager.setPersistenceGovernor(persistence);
		return cashBookManager;
	}
}
